﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<TemplateWeb.Models.ViewModels.GroupViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <div class="cate_area" style="float: left">
        <% 
            var lstSachBanChay = Model.SachModel.GetModel.LstObjModel.Where(n => n.HangMuc.Equals(StringEnum.GetStringValue(HangMucSach.BEST_SELLER))).OrderByDescending(n2 => n2.NgayXuatBan).Take(8).ToList();
            var numRow = lstSachBanChay.Count > 4 ? 2 : 1;
        %>
        <div class="bg_760">
            <h4>
                <a id="ContentPlaceHolder1_hplTitle1" href="http://www.gigabook.vn/ProductsByCategory.aspx?catid=1&amp;sort=extint%20desc">
                    Sách bán chạy</a>
            </h4>
        </div>
        <div class="bg_760_center">
            <% var ItemIndex = 0;
               for (int i = 0; i < numRow; i++)
               { %>
            <div class="product_list" style="padding-left: 15px;">
                <% for (int j = ItemIndex; j < lstSachBanChay.Count; j++)
                   { %>
                <div class="prod_item">
                    <center>
                        <a href="<%= Url.Action("ChiTietSach", "Home", new { id = lstSachBanChay[j].ID }) %>">
                            <img src="../../Content/Images/Items/<%= lstSachBanChay[j].SanPham.HinhMinhHoa %>"
                                alt="<%= lstSachBanChay[j].SanPham.TenSanPham %>>" width="120" height="160" /></a>
                        <p class="prod_name">
                            <a href="<%= Url.Action("ChiTietSach", "Home", new { id = lstSachBanChay[j].ID }) %>">
                                <%= lstSachBanChay[j].SanPham.TenSanPham %></a></p>
                        <p class="font_price">
                            Giá bìa:
                            <%= string.Format("{0:0,0}", lstSachBanChay[j].SanPham.GiaBan)%>
                            ₫</p>
                    </center>
                </div>
                <% ItemIndex++;
                   if (ItemIndex > 0 && ItemIndex % 4 == 0)
                   {
                       break;
                   }
                   } %>
            </div>
            <% } %>
        </div>
        <div class="product_list">
        </div>
        <div class="bg_760_bt">
        </div>
    </div>
    <div class="cate_area" style="float: left">
        <% 
            var lstSachMoi = Model.SachModel.GetModel.LstObjModel.Where(n => n.HangMuc.Equals(StringEnum.GetStringValue(HangMucSach.TIEU_BIEU))).OrderByDescending(n2 => n2.NgayXuatBan).Take(8).ToList();
            numRow = lstSachMoi.Count > 4 ? 2 : 1;
        %>
        <div class="bg_760">
            <h4>
                <a id="ContentPlaceHolder1_hplTitle3" href="http://www.gigabook.vn/ProductsByCategory.aspx?catid=1&amp;sort=publishdate%20desc">
                    Sách mới</a>
            </h4>
        </div>
        <div class="bg_760_center">
        <% ItemIndex = 0;
           for (int i = 0; i < numRow; i++)
           { %>
            <div class="product_list">
                <% for (int j = ItemIndex; j < lstSachMoi.Count; j++)
                   { %>
                <div class="prod_item">
                    <center>
                        <a href="<%= Url.Action("ChiTietSach", "Home", new { id = lstSachBanChay[j].ID }) %>">
                            <img src="../../Content/Images/Items/<%= lstSachMoi[j].SanPham.HinhMinhHoa %>"
                                alt="<%= lstSachMoi[j].SanPham.TenSanPham %>>" width="120" height="160" /></a>
                        <p class="prod_name">
                            <a href="<%= Url.Action("ChiTietSach", "Home", new { id = lstSachBanChay[j].ID }) %>">
                                <%= lstSachMoi[j].SanPham.TenSanPham%></a></p>
                        <p class="font_price">
                            Giá bìa:
                            <%= string.Format("{0:0,0}", lstSachMoi[j].SanPham.GiaBan)%>
                            ₫</p>
                    </center>
                </div>
                <% ItemIndex++;
                   if (ItemIndex > 0 && ItemIndex % 4 == 0)
                   {
                       break;
                   }
                   } %>
            </div>
            <% } %>
        </div>
        <div class="bg_760_bt">
        </div>
    </div>
</asp:Content>
